package com.example.addemoone

import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Spinner
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat

class HomeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_home)
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }

        val citiesSpinner = findViewById<Spinner>(R.id.sp_city)
        // 中国城市列表
        val cities = arrayOf("北京", "上海", "广州", "深圳", "杭州", "南京", "西安", "武汉", "成都", "天津", "重庆", "苏州", "无锡", "厦门", "青岛", "郑州", "济南", "福州", "烟台", "珠海", "佛山", "东莞", "中山", "石家庄", "太原", "西安", "武汉", "长沙", "合肥", "杭州")
        // spinner适配器
        val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_item, cities)
        citiesSpinner.adapter = adapter
    }
}